<script>
export default {
  name: "son",
  data() {
    return {
      count: 0
    }
  },
  methods: {
    handler() {
      this.count++
      this.$emit("changeCount",this.count)
    }
  }
}
</script>

<template>
  <section>
    <h1>我是子组件我的数据是：{{ count }}</h1>
    <button @click="handler">+1</button>
  </section>
</template>

<style scoped lang="less">
section {
  background-color: red;
}
</style>